package io.github.mvertl;

public class AbstractDomainEntity {

    private int domainStatus = -2;

    private final int deleted = -1;

    private final int loaded = 0;

    private final int add = 1;

    private final int updated = 2;

    public void loaded() {
        this.domainStatus = this.loaded;
    }

    public boolean isLoaded() {
        return this.domainStatus != -2;
    }

    public void deleted() {
        this.domainStatus = this.deleted;
    }

    public boolean isDeleted() {
        return this.isLoaded() && this.domainStatus == this.deleted;
    }

    public void add() {
        this.domainStatus = this.add;
    }

    public boolean isAdd() {
        return this.domainStatus == this.add;
    }

    public void updated() {
        this.domainStatus = this.updated;
    }

    public boolean isUpdated() {
        return this.isLoaded() && this.domainStatus == this.updated;
    }

}
